\doxysection{bsp\+\_\+pwm.\+h}
\hypertarget{bsp__pwm_8h_source}{}\label{bsp__pwm_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/bsp/pwm/bsp\_pwm.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/bsp/pwm/bsp\_pwm.h}}
\mbox{\hyperlink{bsp__pwm_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#ifndef\ BSP\_PWM\_H}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ BSP\_PWM\_H}}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{tim_8h}{tim.h}}"{}}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ "{}stdint.h"{}}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{stm32h7xx__hal__rcc_8h}{stm32h7xx\_hal\_rcc.h}}"{}}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{stm32h723xx_8h}{stm32h723xx.h}}"{}}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#define\ PWM\_DEVICE\_CNT\ 16\ }\textcolor{comment}{//\ 最大支持的PWM实例数量}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{comment}{/*\ pwm实例结构体\ */}}
\DoxyCodeLine{00022\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{structpwm__ins__temp}{pwm\_ins\_temp}}}
\DoxyCodeLine{00023\ \{}
\DoxyCodeLine{00024\ \ \ \ \ \mbox{\hyperlink{struct_t_i_m___handle_type_def}{TIM\_HandleTypeDef}}\ *htim;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ TIM句柄}}
\DoxyCodeLine{00025\ \ \ \ \ uint32\_t\ channel;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 通道}}
\DoxyCodeLine{00026\ \ \ \ \ uint32\_t\ tclk;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 时钟频率}}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keywordtype}{float}\ period;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 周期}}
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keywordtype}{float}\ dutyratio;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 占空比}}
\DoxyCodeLine{00029\ \ \ \ \ void\ (*callback)(\textcolor{keyword}{struct\ }\mbox{\hyperlink{structpwm__ins__temp}{pwm\_ins\_temp}}\ *);\ \textcolor{comment}{//\ DMA传输完成回调函数}}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keywordtype}{void}\ *id;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 实例ID}}
\DoxyCodeLine{00031\ \}\ PWMInstance;}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00034\ \{}
\DoxyCodeLine{00035\ \ \ \ \ \mbox{\hyperlink{struct_t_i_m___handle_type_def}{TIM\_HandleTypeDef}}\ *htim;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ TIM句柄}}
\DoxyCodeLine{00036\ \ \ \ \ uint32\_t\ channel;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 通道}}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keywordtype}{float}\ period;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 周期}}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keywordtype}{float}\ dutyratio;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 占空比}}
\DoxyCodeLine{00039\ \ \ \ \ void\ (*callback)(PWMInstance*);\ \textcolor{comment}{//\ DMA传输完成回调函数}}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{void}\ *id;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 实例ID}}
\DoxyCodeLine{00041\ \}\ \mbox{\hyperlink{struct_p_w_m___init___config__s}{PWM\_Init\_Config\_s}};}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00049\ PWMInstance\ *\mbox{\hyperlink{bsp__pwm_8h_a2120d2df21cbc0f5ce613cc894656623}{PWMRegister}}(\mbox{\hyperlink{struct_p_w_m___init___config__s}{PWM\_Init\_Config\_s}}\ *config);}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00056\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{bsp__pwm_8h_acd81680ae1e7064b568493eb50d0c6d2}{PWMStart}}(PWMInstance\ *pwm);}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{bsp__pwm_8h_a1b6f35949a04703824318426cf726fe3}{PWMSetDutyRatio}}(PWMInstance\ *pwm,\ \textcolor{keywordtype}{float}\ dutyratio);}
\DoxyCodeLine{00070\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{bsp__pwm_8h_a0424e2983ba296a8acfa3a79bbad04a0}{PWMStop}}(PWMInstance\ *pwm);}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00078\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{bsp__pwm_8h_a873e5ee427c6c73ce3c444daf26ac769}{PWMSetPeriod}}(PWMInstance\ *pwm,\ \textcolor{keywordtype}{float}\ period);}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00089\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{bsp__pwm_8h_a4ad1e4350071eb83a7696aa52c586abf}{PWMStartDMA}}(PWMInstance\ *pwm,\ uint32\_t\ *pData,\ uint32\_t\ Size);}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ BSP\_PWM\_H}}

\end{DoxyCode}
